import axios from '@/axios'
enum API {
    USER_GETALL = '/getUserAll',
    USER_GETPAGE = '/getUserPage',
    USER_GETKEYPAGE = '/SearchUserKey',
    USER_UPDATEBYID = '/updataUserById',
    USER_DELETEBYID = '/deleteUserById',
    USER_DELETEMOREBYID='/deleteUserMoreById',
    USER_SEARCHBYID='/searchMybyId',
    USER_AVATARIMG='/upload/avatar', //用户头像上传
    USER_UPDATEBASEBYID='updataBaseUserById',
    USER_UPDATEECXBYID='updataEcxUserById',
    
    
  }
// 获取所有用户信息
export const getUserAllAPI = () => axios.get(API.USER_GETALL)
// 分页查询用户
export const getUserPageAPI = (data:any) => axios.post(API.USER_GETPAGE, data)
// 指定key-value分页查询用户
export const getUserKeyPageAPI = (data:any) => axios.post(API.USER_GETKEYPAGE, data)
// 根据id更新用户
export const UpdateUserByIdAPI = (data:any) => axios.post(API.USER_UPDATEBYID, data)
// 根据id删除用户
export const DeleteUserByIdAPI = (userId:string) => axios.delete(`${API.USER_DELETEBYID}/${userId}`)
// 根据id批量用户
export const DeleteUserMoreByIdAPI = (ids:any) => axios.post(API.USER_DELETEMOREBYID, ids)
// 根据Id连表查询指定用户
export const SearcMyByIdAPI = (id:string) => axios.get(`${API.USER_SEARCHBYID}/${id}`)
// 用户头像上传
export const upAvatarImg=(file: File,id:any)=>{
  const formData = new FormData();
  formData.append("file", file);
    // 设置请求头
    const config = {
      headers: {
        "x-user-id": id // 自定义请求头字段，用于设置存储文件名(暂不支持中文)
      }
    };
  return axios.post(API.USER_AVATARIMG, formData,config);
}
// 根据id更新用户基本信息
export const UpdateUserBaseByIdAPI = (data:any) => axios.post(API.USER_UPDATEBASEBYID, data)
// 根据id更新用户职业经历
export const UpdateUserEcxByIdAPI = (data:any) => axios.post(API.USER_UPDATEECXBYID, data)